package cn.itcast.travel.web.servlet.blog;

import cn.itcast.travel.service.BlogService;
import cn.itcast.travel.service.impl.BlogServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "Blog", value = "/Blog")
public class getallblog extends HttpServlet {
    BlogService service=new BlogServiceImpl();
    //获取所有博客
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ObjectMapper ob=new ObjectMapper();
        ob.writeValue(response.getWriter(),service.getallblog());
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
